Controlling styles and formats

If you use the Narratives module as the public face of your collection (a website for instance), it is important to control how text is formatted in order to have a consistent look to your website. The purposes to which you will put narratives and the degree of control you require may determine which Narrative tab you make available and the restrictions you place on applying styles. For instance, to impose a high level of control it might be prudent to use the plain text tab and prohibit or limit which HTML tags can be applied to text.

Note: Narratives are ideal for use in web-based / online presentations of a collection. Text can be formatted or marked-up in the Narratives module ready for display on the web. However, care needs to be taken to ensure that formatting of content is consistent. Restricting the use of HTML tags takes the form of a staff policy ("Staff will not use HTML tags...") rather than programming control.

WARNING

Copying text out of a Word processing application such as Microsoft Word and pasting it into the formatted text tab will copy over any styles applied in the source document, but will also copy over any number of other hidden HTML styles and classes from the Word document. For instance, the following text was formatted and copied out of a Word document:

Extracted text

It looks innocent enough when pasted into the formatted text tab - the styles and formatting applied in the source document have copied across:

Copied styles

But if we look at the HTML for this text we discover that there's a lot more there than meets the eye:

HTML

Along with the formatting, additional classes, styles and fonts have been copied across, any of which might override styles you attempt to apply when publishing content to the web.

Solution

One way to ensure that text pasted into the Narrative tab is cleared of all styles is to:

  1. Copy the text in the source application.
  2. Paste it into a text editor such as the Windows Notepad.
  3. Copy the text out of Notepad and paste it into the Narrative tab.

    This time if we look at the HTML of the pasted text, it is clean of style information:

    HTML

  4. Format the text appropriately in the Narrative tab.